color21 2.2.0
Loading...
Searching...
No Matches
color21.h File Reference

This file contains API for Color 21 Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  color21_data_t
 Color 21 Click data object. More...
struct  color21_t
 Color 21 Click context object. More...
struct  color21_cfg_t
 Color 21 Click configuration object. More...

Macros

#define COLOR21_REG_AUXID   0x58
 Color 21 register list.
#define COLOR21_REG_REVID   0x59
#define COLOR21_REG_ID   0x5A
#define COLOR21_REG_CFG_12   0x66
#define COLOR21_REG_ENABLE   0x80
#define COLOR21_REG_ATIME   0x81
#define COLOR21_REG_WTIME   0x83
#define COLOR21_REG_ALS_TH_L_LSB   0x84
#define COLOR21_REG_ALS_TH_L_MSB   0x85
#define COLOR21_REG_ALS_TH_H_LSB   0x86
#define COLOR21_REG_ALS_TH_H_MSB   0x87
#define COLOR21_REG_STATUS   0x93
#define COLOR21_REG_ASTATUS   0x94
#define COLOR21_REG_ADATA_0_L   0x95
#define COLOR21_REG_ADATA_0_H   0x96
#define COLOR21_REG_ADATA_1_L   0x97
#define COLOR21_REG_ADATA_1_H   0x98
#define COLOR21_REG_ADATA_2_L   0x99
#define COLOR21_REG_ADATA_2_H   0x9A
#define COLOR21_REG_ADATA_3_L   0x9B
#define COLOR21_REG_ADATA_3_H   0x9C
#define COLOR21_REG_ADATA_4_L   0x9D
#define COLOR21_REG_ADATA_4_H   0x9E
#define COLOR21_REG_ADATA_5_L   0x9F
#define COLOR21_REG_ADATA_5_H   0xA0
#define COLOR21_REG_ADATA_6_L   0xA1
#define COLOR21_REG_ADATA_6_H   0xA2
#define COLOR21_REG_ADATA_7_L   0xA3
#define COLOR21_REG_ADATA_7_H   0xA4
#define COLOR21_REG_ADATA_8_L   0xA5
#define COLOR21_REG_ADATA_8_H   0xA6
#define COLOR21_REG_ADATA_9_L   0xA7
#define COLOR21_REG_ADATA_9_H   0xA8
#define COLOR21_REG_ADATA_10_L   0xA9
#define COLOR21_REG_ADATA_10_H   0xAA
#define COLOR21_REG_ADATA_11_L   0xAB
#define COLOR21_REG_ADATA_11_H   0xAC
#define COLOR21_REG_ADATA_12_L   0xAD
#define COLOR21_REG_ADATA_12_H   0xAE
#define COLOR21_REG_ADATA_13_L   0xAF
#define COLOR21_REG_ADATA_13_H   0xB0
#define COLOR21_REG_ADATA_14_L   0xB1
#define COLOR21_REG_ADATA_14_H   0xB2
#define COLOR21_REG_ADATA_15_L   0xB3
#define COLOR21_REG_ADATA_15_H   0xB4
#define COLOR21_REG_ADATA_16_L   0xB5
#define COLOR21_REG_ADATA_16_H   0xB6
#define COLOR21_REG_ADATA_17_L   0xB7
#define COLOR21_REG_ADATA_17_H   0xB8
#define COLOR21_REG_STATUS_2   0x90
#define COLOR21_REG_STATUS_3   0x91
#define COLOR21_REG_STATUS_5   0xBB
#define COLOR21_REG_STATUS_4   0xBC
#define COLOR21_REG_CFG_0   0xBF
#define COLOR21_REG_CFG_1   0xC6
#define COLOR21_REG_CFG_3   0xC7
#define COLOR21_REG_CFG_6   0xF5
#define COLOR21_REG_CFG_8   0xC9
#define COLOR21_REG_CFG_9   0xCA
#define COLOR21_REG_CFG_10   0x65
#define COLOR21_REG_PERS   0xCF
#define COLOR21_REG_GPIO   0x6B
#define COLOR21_REG_ASTEP_LSB   0xD4
#define COLOR21_REG_ASTEP_MSB   0xD5
#define COLOR21_REG_CFG_20   0xD6
#define COLOR21_REG_LED   0xCD
#define COLOR21_REG_AGC_GAIN_MAX   0xD7
#define COLOR21_REG_AZ_CONFIG   0xDE
#define COLOR21_REG_FD_TIME_1   0xE0
#define COLOR21_REG_FD_TIME_2   0xE2
#define COLOR21_REG_FD_CFG_0   0xDF
#define COLOR21_REG_FD_STATUS   0xE3
#define COLOR21_REG_INTENAB   0xF9
#define COLOR21_REG_CONTROL   0xFA
#define COLOR21_REG_FIFO_MAP   0xFC
#define COLOR21_REG_FIFO_LVL   0xFD
#define COLOR21_REG_FDATA_L   0xFE
#define COLOR21_REG_FDATA_H   0xFF
#define COLOR21_ENABLE_FDEN   0x40
 Color 21 ENABLE register setting.
#define COLOR21_ENABLE_SMUXEN   0x10
#define COLOR21_ENABLE_WEN   0x08
#define COLOR21_ENABLE_ALS_EN   0x02
#define COLOR21_ENABLE_PON   0x01
#define COLOR21_ENABLE_POFF   0x00
#define COLOR21_CFG_0_LOW_POWER   0x20
 Color 21 CFG_0 register setting.
#define COLOR21_CFG_0_REG_BANK   0x10
#define COLOR21_CFG_0_WLONG   0x04
#define COLOR21_CFG_1_AGAIN_0_5   0x00
 Color 21 CFG_1 register setting.
#define COLOR21_CFG_1_AGAIN_1   0x01
#define COLOR21_CFG_1_AGAIN_2   0x02
#define COLOR21_CFG_1_AGAIN_4   0x03
#define COLOR21_CFG_1_AGAIN_8   0x04
#define COLOR21_CFG_1_AGAIN_16   0x05
#define COLOR21_CFG_1_AGAIN_32   0x06
#define COLOR21_CFG_1_AGAIN_64   0x07
#define COLOR21_CFG_1_AGAIN_128   0x08
#define COLOR21_CFG_1_AGAIN_256   0x09
#define COLOR21_CFG_1_AGAIN_512   0x0A
#define COLOR21_CFG_1_AGAIN_1024   0x0B
#define COLOR21_CFG_1_AGAIN_2048   0x0C
#define COLOR21_CFG_1_AGAIN_MASK   0x1F
#define COLOR21_CFG_20_FD_FIFO_8BIT   0x80
 Color 21 CFG_20 register setting.
#define COLOR21_CFG_20_AUTO_SMUX_6CH   0x00
#define COLOR21_CFG_20_AUTO_SMUX_12CH   0x40
#define COLOR21_CFG_20_AUTO_SMUX_18CH   0x60
#define COLOR21_CFG_20_AUTO_SMUX_MASK   0x60
#define COLOR21_CONTROL_SW_RESET   0x08
 Color 21 CONTROL register setting.
#define COLOR21_CONTROL_ALS_MAN_AZ   0x04
#define COLOR21_CONTROL_FIFO_CLR   0x02
#define COLOR21_CONTROL_CLEAR_SAI_ACT   0x01
#define COLOR21_LED_OFF   0x00
 Color 21 LED register setting.
#define COLOR21_LED_ON   0x80
#define COLOR21_LED_DRIVE_CURR_MIN   4
#define COLOR21_LED_DRIVE_CURR_MAX   258
#define COLOR21_LED_DRIVE_CURR_STEP   2
#define COLOR21_LED_DRIVE_CURR_DEFAULT   8
#define COLOR21_STATUS_ASAT   0x80
 Color 21 STATUS register setting.
#define COLOR21_STATUS_AINT   0x08
#define COLOR21_STATUS_FINT   0x04
#define COLOR21_STATUS_SINT   0x01
#define COLOR21_ASTATUS_ASAT   0x80
 Color 21 ASTATUS register setting.
#define COLOR21_ASTATUS_AGAIN_MASK   0x0F
#define COLOR21_STATUS_2_AVALID   0x40
 Color 21 STATUS_2 register setting.
#define COLOR21_STATUS_2_ASAT_DIG   0x10
#define COLOR21_STATUS_2_ASAT_ANA   0x08
#define COLOR21_STATUS_2_FDSAT_ANA   0x02
#define COLOR21_STATUS_2_FDSAT_DIG   0x01
#define COLOR21_DEVICE_ID   0x81
 Color 21 device ID value.
#define COLOR21_ACCESS_REG_BANK_ABOVE_80H   0
 Color 21 register bank access setting.
#define COLOR21_ACCESS_REG_BANK_20H_7FH   1
#define COLOR21_SINGLE_STEP_MS   0.00278f
 Color 21 integration time setting.
#define COLOR21_ATIME_MAX   255
#define COLOR21_ASTEP_MAX   65534
#define COLOR21_INTEGRATION_TIME_MAX   ( ( float ) ( COLOR21_ATIME_MAX + 1 ) * ( COLOR21_ASTEP_MAX + 1 ) * COLOR21_SINGLE_STEP_MS )
#define COLOR21_INTEGRATION_TIME_MIN   COLOR21_SINGLE_STEP_MS
#define COLOR21_INTEGRATION_TIME_DEFAULT   90.0f
#define COLOR21_WAIT_STEP_MS   2.78f
#define COLOR21_WTIME_MAX   255
#define COLOR21_WAIT_TIME_MAX   ( ( float ) ( COLOR21_WTIME_MAX + 1 ) * COLOR21_WAIT_STEP_MS )
#define COLOR21_WAIT_TIME_MIN   COLOR21_WAIT_STEP_MS
#define COLOR21_WAIT_TIME_DEFAULT   100.0f
#define COLOR21_DEVICE_ADDRESS   0x59
 Color 21 device address setting.
#define COLOR21_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.

Enumerations

enum  color21_return_value_t { COLOR21_OK = 0 , COLOR21_ERROR = -1 }
 Color 21 Click return value data. More...

Functions

void color21_cfg_setup (color21_cfg_t *cfg)
 Color 21 configuration object setup function.
err_t color21_init (color21_t *ctx, color21_cfg_t *cfg)
 Color 21 initialization function.
err_t color21_default_cfg (color21_t *ctx)
 Color 21 default configuration function.
err_t color21_generic_write (color21_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Color 21 I2C writing function.
err_t color21_generic_read (color21_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Color 21 I2C reading function.
err_t color21_write_reg (color21_t *ctx, uint8_t reg, uint8_t data_in)
 Color 21 write register function.
err_t color21_read_reg (color21_t *ctx, uint8_t reg, uint8_t *data_out)
 Color 21 read register function.
err_t color21_write_reg_word (color21_t *ctx, uint8_t reg, uint16_t data_in)
 Color 21 write register word function.
err_t color21_read_reg_word (color21_t *ctx, uint8_t reg, uint16_t *data_out)
 Color 21 read register word function.
err_t color21_check_communication (color21_t *ctx)
 Color 21 check communication function.
void color21_set_ldr_pin (color21_t *ctx, uint8_t state)
 Color 21 set ldr pin function.
uint8_t color21_get_int_pin (color21_t *ctx)
 Color 21 get int pin function.
uint8_t color21_get_io_pin (color21_t *ctx)
 Color 21 get io pin function.
err_t color21_set_reg_bank_access (color21_t *ctx, uint8_t reg_bank)
 Color 21 set reg bank access function.
err_t color21_disable_ext_led (color21_t *ctx)
 Color 21 disable ext led function.
err_t color21_enable_ext_led (color21_t *ctx, uint16_t led_curr)
 Color 21 enable ext led function.
err_t color21_set_integration_time_ms (color21_t *ctx, float int_time_ms)
 Color 21 set integration time ms function.
err_t color21_set_wait_time_ms (color21_t *ctx, float wait_time_ms)
 Color 21 set wait time ms function.
err_t color21_read_data (color21_t *ctx, color21_data_t *data_out)
 Color 21 read data function.

Detailed Description

This file contains API for Color 21 Click Driver.

Enumeration Type Documentation

◆ color21_return_value_t

Color 21 Click return value data.

Predefined enum values for driver return values.

Enumerator
COLOR21_OK 
COLOR21_ERROR